package com.talkweb.platform.commonapi.utils;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class ServerLoggerUtil {

	private static String localIP = null;


	/**
	 * 
	 * @return local ip
	 */
	public static String getLocalIP() {
		String ip[] = null;
		if (localIP != null) {
			return localIP;
		} else {
			try {
				InetAddress ia = InetAddress.getLocalHost();
				String inetAddr = ia.toString();
				ip = inetAddr.split("/");
				localIP = ip[1];
				return localIP;
			} catch (UnknownHostException e) {
				return null;
			}
		}
	}
}
